package ro.imc.ums.dani.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Database {
	
	private Connection conn = null;
	
	public Database(){
			
	try {
		Class.forName("com.mysql.jdbc.Driver");		
		conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/ums", "root", "");
		if(conn != null){
			System.out.println("You had connected to yer database matey! Ahoy!");
		}
		//Statement sqlState = conn.createStatement();
		//String selectStuff = "select FirstName from students";
		//ResultSet rows = sqlState.executeQuery(selectStuff);
		//while(rows.next()){
			//System.out.println(rows.getString("FirstName"));
		//}
	} catch (SQLException ex){
		ex.printStackTrace();
		 //System.out.println("SQLException: " + ex.getMessage());
		// System.out.println("VendorError: " + ex.getErrorCode());
	} catch (ClassNotFoundException e){
		e.printStackTrace();
	}
	}
}
